// 80.删除有序数组中的重复项
package Leetcode_Second_Brush;

public class Solution080 {
    public int removeDuplicates(int[] nums) {
        int length = nums.length;

        if (length <= 2)
            return length;

        int left = 2, right = 2;

        while (right < length) {
            if (nums[right] == nums[left - 2])
                right++;
            else {
                nums[left++] = nums[right++];
            }
        }

        return left;
    }
}
